1 package net.sf.mmapps.applications.developer; 2 3 import java.awt.*; 4 5 import javax.swing.*; 6 /*** 7 * @author Kees Jongenburger 8 * @version $ID: $ 9 */ 10 public class MainPanel extends JPanel { 11 12 JDesktopPane jDesktopPane ; 13 /*** Creates a new instance of MainPanel */ 14 public MainPanel() { 15 super(); 16 setLayout(new BorderLayout()); 17 add(jDesktopPane = new JDesktopPane(),BorderLayout.CENTER); 18 } 19 20 public void createAndAddInternalFrame(String title , Component component){ 21 Dimension mydim = getSize(); 22 JInternalFrame frame = new JInternalFrame(title); 23 frame.getContentPane().setLayout(new BorderLayout()); 24 frame.getContentPane().add(component,BorderLayout.CENTER); 25 Dimension dim = component.getPreferredSize(); 26 frame.setBounds(0,0, (dim.width < mydim.width)?dim.width:mydim.width,(dim.height < mydim.height)?dim.height:mydim.height); 27 frame.setResizable(true); 28 frame.setIconifiable(true); 29 frame.setMaximizable(true); 30 frame.setClosable(true); 31 32 jDesktopPane.add(frame,new Integer(1)); 33 frame.setVisible(true); 34 } 35 }